using System;

using SBPweb.Modules.Modularity;

namespace SBPweb.Modules.Dependencies
{

	/// <summary>
	/// This class extends VersionDependency class, handles Module version check
	/// </summary>
    public class ModuleVersionDependency : VersionDependency<ModuleDescriptor>
    {

        #region Constructor logic

		/// <summary>
		/// Initializes a new ModuleVersionDependency instance
		/// </summary>
		/// <param name="value">Version criteria - can be a version mask or range</param>
		/// <param name="descriptor">ModuleDescriptor of module</param>
        public ModuleVersionDependency(string value, ModuleDescriptor descriptor)
            : base(value, descriptor)
        {
            if (descriptor == null)
            {
                throw new ArgumentNullException();
            }
        }

        #endregion

		/// <summary>
		/// This method extracts version of the depender module
		/// </summary>
		protected override void ExtractVersion()
        {
            pVersion = new System.Version(Depender.FileVersion);
        }

    }
}
